<template>
	<div class="left-bar" v-loading="loading">
        <left-duty-card :list="dutyList"></left-duty-card>
        <left-onduty-card :list="ondutyList"></left-onduty-card>
		<left-age-card :list="ageList" v-loading='loading'></left-age-card>
	</div>
	<div class="center-bar" v-loading="loading">
		<center-top :list="datasList"></center-top>
        <template v-if="!loading">
            <center-map :mapList="mapList"></center-map>
        </template>
	</div>
	<div class="right-bar" v-loading="loading">
        <right-data-statistical-comparison :mapList="mapList"></right-data-statistical-comparison>
        <right-money-card :list="moneyList" v-loading='loading'></right-money-card>
        <right-video :list="videoList"></right-video>
    </div>
</template>

<script setup>
import { getScreenData, getCityList } from "../common/apis";
import { onMounted, watch } from "vue";
import { useStore } from 'vuex';
import util from "../common/utils";
import LeftDutyCard from "../components/Home/LeftDutyCard.vue";
import LeftOndutyCard from "../components/Home/LeftOndutyCard.vue";
import LeftAgeCard from "../components/Home/LeftAgeCard.vue";

import CenterTop from "../components/Home/CenterTop.vue";
import CenterMap from "../components/Home/CenterMap.vue";

import RightMoneyCard from "../components/Home/RightMoneyCard.vue";
import RightDataStatisticalComparison from "../components/Home/RightDataStatisticalComparison.vue";
import RightVideo from "../components/Home/RightVideo.vue";

const store = useStore()

const loading = $ref(true)

const sexList = $ref([]);//性别统计
const ageList = $ref([]);//年龄分布
const moneyList = $ref([]);//补贴
const dutyList = $ref([]);//公益岗列表
const ondutyList = $ref([]);//上岗人员
const videoList = $ref([]);//视频
const datasList = $ref([]);//信息统计
const mapList = $ref([]);//地图

watch(
	() => store.state.currentCityCode,
	(newV, oldV) => {
        getData(store.state.currentCityCode)
	}
)


onMounted(async ()=>{
    getData()
})
const getData = async (sysOrgCode = 'A01')=>{
    // let res = await getScreenData({sysOrgCode: sysOrgCode});
    let res = {
    "success": true,
    "message": "",
    "code": 200,
    "result": {
        "1": [
            {
                "id": "1579386460983357441",
                "createBy": "admin",
                "createTime": "2022-10-10 16:20:50",
                "updateBy": "admin",
                "updateTime": "2022-10-16 15:13:14",
                "sysOrgCode": "A01",
                "type": "1",
                "val1": "男性占比",
                "val2": "7425人",
                "val3": "48.1%",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579386614239031297",
                "createBy": "admin",
                "createTime": "2022-10-10 16:21:27",
                "updateBy": "admin",
                "updateTime": "2022-10-16 15:13:22",
                "sysOrgCode": "A01",
                "type": "1",
                "val1": "女性占比",
                "val2": "8030人",
                "val3": "51.9%",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ],
        "2": [
            {
                "id": "1579388302140207106",
                "createBy": "admin",
                "createTime": "2022-10-10 16:28:09",
                "updateBy": "admin",
                "updateTime": "2022-10-19 09:23:03",
                "sysOrgCode": "A01",
                "type": "2",
                "val1": "城乡公益岗上岗人数（人）",
                "val2": "65753",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579388453206454273",
                "createBy": "admin",
                "createTime": "2022-10-10 16:28:45",
                "updateBy": "admin",
                "updateTime": "2022-10-19 18:55:08",
                "sysOrgCode": "A01",
                "type": "2",
                "val1": "累计补贴额度（万元）",
                "val2": "35673.24",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579388609813377025",
                "createBy": "admin",
                "createTime": "2022-10-10 16:29:23",
                "updateBy": "admin",
                "updateTime": "2022-10-19 09:23:29",
                "sysOrgCode": "A01",
                "type": "2",
                "val1": "城乡公益岗拓岗人数（人）",
                "val2": "67865",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ],
        "3": [
            {
                "id": "1579397112804241410",
                "createBy": "admin",
                "createTime": "2022-10-10 17:03:10",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:17:23",
                "sysOrgCode": "A01",
                "type": "3",
                "val1": "20-29岁",
                "val2": "1478",
                "val3": "27.04%",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579397237706420225",
                "createBy": "admin",
                "createTime": "2022-10-10 17:03:39",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:17:46",
                "sysOrgCode": "A01",
                "type": "3",
                "val1": "30-39岁",
                "val2": "1078",
                "val3": "24.17%",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579397373966774274",
                "createBy": "admin",
                "createTime": "2022-10-10 17:04:12",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:18:13",
                "sysOrgCode": "A01",
                "type": "3",
                "val1": "40-49岁",
                "val2": "478",
                "val3": "14.54%",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579397489599541249",
                "createBy": "admin",
                "createTime": "2022-10-10 17:04:40",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:18:52",
                "sysOrgCode": "A01",
                "type": "3",
                "val1": "50岁以上",
                "val2": "1778",
                "val3": "34.25%",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ],
        "4": [
            {
                "id": "1579758011792531458",
                "createBy": "admin",
                "createTime": "2022-10-11 16:57:15",
                "updateBy": "admin",
                "updateTime": "2022-10-20 11:07:49",
                "sysOrgCode": "A01",
                "type": "4",
                "val1": "岗位补贴",
                "val2": "240, 278, 222, 288, 244, 290",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579758272585965570",
                "createBy": "admin",
                "createTime": "2022-10-11 16:58:17",
                "updateBy": "admin",
                "updateTime": "2022-10-20 11:08:52",
                "sysOrgCode": "A01",
                "type": "4",
                "val1": "意外伤害保险",
                "val2": "180, 160, 200, 150, 179, 166",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579758386033500161",
                "createBy": "admin",
                "createTime": "2022-10-11 16:58:44",
                "updateBy": "admin",
                "updateTime": "2022-10-20 11:10:08",
                "sysOrgCode": "A01",
                "type": "4",
                "val1": "社保补贴",
                "val2": "140, 210, 266, 215, 177, 198",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ],
        "5": [
            {
                "id": "1579389916221632514",
                "createBy": "admin",
                "createTime": "2022-10-10 16:34:34",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:10:21",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "9896",
                "val2": "护林绿化",
                "val3": "400",
                "val4": "5.13%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579396315353804801",
                "createBy": "admin",
                "createTime": "2022-10-10 17:00:00",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:10:48",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "7795",
                "val2": "环境保护",
                "val3": "486",
                "val4": "6.23%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579396555666452482",
                "createBy": "admin",
                "createTime": "2022-10-10 17:00:57",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:11:08",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "7795",
                "val2": "森林防火",
                "val3": "507",
                "val4": "6.5%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579396724541714433",
                "createBy": "admin",
                "createTime": "2022-10-10 17:01:37",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:11:42",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "7795",
                "val2": "村容保洁",
                "val3": "4775",
                "val4": "61.26%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1581873034854219778",
                "createBy": "admin",
                "createTime": "2022-10-17 13:01:35",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:12:45",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "7795",
                "val2": "道路管护",
                "val3": "231",
                "val4": "2.96%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1581873516175769602",
                "createBy": "admin",
                "createTime": "2022-10-17 13:03:30",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:13:08",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "7795",
                "val2": "生态环境",
                "val3": "896",
                "val4": "11.49%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1581873667707584513",
                "createBy": "admin",
                "createTime": "2022-10-17 13:04:06",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:13:31",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "7795",
                "val2": "水利管护",
                "val3": "404",
                "val4": "5.18%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1581873803137466370",
                "createBy": "admin",
                "createTime": "2022-10-17 13:04:39",
                "updateBy": "admin",
                "updateTime": "2022-10-17 13:13:54",
                "sysOrgCode": "A01",
                "type": "5",
                "val1": "7795",
                "val2": "运河湿地",
                "val3": "96",
                "val4": "1.23%",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ],
        "6": [
            {
                "id": "1579399291023749121",
                "createBy": "admin",
                "createTime": "2022-10-10 17:11:49",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:26:31",
                "sysOrgCode": "A01",
                "type": "6",
                "val1": "零就业家庭人员",
                "val2": "330",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579399423249182721",
                "createBy": "admin",
                "createTime": "2022-10-10 17:12:21",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:26:42",
                "sysOrgCode": "A01",
                "type": "6",
                "val1": "城镇大龄失业人员",
                "val2": "843",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579399651431903234",
                "createBy": "admin",
                "createTime": "2022-10-10 17:13:15",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:25:31",
                "sysOrgCode": "A01",
                "type": "6",
                "val1": "乡村脱贫享受政策人口",
                "val2": "823",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579400042223595521",
                "createBy": "admin",
                "createTime": "2022-10-10 17:14:48",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:25:45",
                "sysOrgCode": "A01",
                "type": "6",
                "val1": "乡村低收入人口",
                "val2": "535",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579400168916742145",
                "createBy": "admin",
                "createTime": "2022-10-10 17:15:18",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:25:56",
                "sysOrgCode": "A01",
                "type": "6",
                "val1": "乡村残疾人",
                "val2": "331",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579400501902536706",
                "createBy": "admin",
                "createTime": "2022-10-10 17:16:38",
                "updateBy": "admin",
                "updateTime": "2022-10-19 08:26:09",
                "sysOrgCode": "A01",
                "type": "6",
                "val1": "乡村大龄人员",
                "val2": "810",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ],
        "7": [
            {
                "id": "1579400709398949890",
                "createBy": "admin",
                "createTime": "2022-10-10 17:17:27",
                "updateBy": null,
                "updateTime": null,
                "sysOrgCode": "A01",
                "type": "7",
                "val1": null,
                "val2": null,
                "val3": null,
                "val4": null,
                "val5": null,
                "val6": null,
                "val7": null,
                "val8": null,
                "val9": "",
                "val10": "https://zzrs.tengcity.com/screen/assets/1020.mp4"
            }
        ],
        "8": [
            {
                "id": "1579678197513482241",
                "createBy": "admin",
                "createTime": "2022-10-11 11:40:06",
                "updateBy": "admin",
                "updateTime": "2022-10-16 15:17:38",
                "sysOrgCode": "A01",
                "type": "8",
                "val1": "驿站",
                "val2": "2131",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            },
            {
                "id": "1579678295458869250",
                "createBy": "admin",
                "createTime": "2022-10-11 11:40:29",
                "updateBy": "admin",
                "updateTime": "2022-10-16 15:17:31",
                "sysOrgCode": "A01",
                "type": "8",
                "val1": "公益岗",
                "val2": "15455",
                "val3": "",
                "val4": "",
                "val5": "",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ],
        "9": [
            {
                "id": "1579768603077025793",
                "createBy": "admin",
                "createTime": "2022-10-11 17:39:20",
                "updateBy": "admin",
                "updateTime": "2022-10-19 09:23:21",
                "sysOrgCode": "A01",
                "type": "9",
                "val1": "滕州市",
                "val2": "【尚善】",
                "val3": "3750",
                "val4": "6785",
                "val5": "3390",
                "val6": "",
                "val7": "",
                "val8": "",
                "val9": "",
                "val10": ""
            }
        ]
    },
    "timestamp": 1669106171851
}
    if(res.success){
        
        let {
            1:sex,
            2:datas,
            3:age,
            4:money,
            5:duty,
            6:onduty,
            7:video,
            9:city,
        } = res.result;
        sexList = sex;
        datasList = datas;
        if(money) moneyList = money;
        ageList = age;
        dutyList = duty;
        ondutyList = onduty;
        if(video) videoList = video;
        if(city) mapList = city;
        loading = false;
    }else{
        util.toast(res.message);
    }
}

const getCityData = () => {
    getCityList().then(res => {
        store.state.cityData['枣庄市'] = 'A01'
        res.result.map(item => {
            store.state.cityData[item.departName] = item.orgCode
        })
    })
}
getCityData()

</script>

<style scoped lang="scss">
.left-bar {
	position: absolute;
	top: 114px;
	left: 40px;
	width: 453px;
}
.center-bar {
	position: absolute;
	top: 114px;
	left: 512px;
}
.right-bar{
    position:absolute;
    top:114px;
    right:40px;
    width:453px;
}
</style>
